package com.car.demo.controller;

import com.car.demo.impl.CarDaoImpl;
import com.car.demo.model.CarEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/try")
@EnableAutoConfiguration
public class CarController {
    @Autowired
    private CarDaoImpl carDaoImpl;
    @GetMapping(value = "car")
    public List<CarEntity> getAllData(){
        return carDaoImpl.getAllData();
    }

    @GetMapping(value = "car/{name}")
    public  List<CarEntity> getByName(@PathVariable String name){
        return carDaoImpl.getByName(name);
    }

}
